load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")
load("../../defs.bzl", "folly_xplat_library")

oncall("fbcode_entropy_wardens_folly")

fb_dirsync_cpp_library(
    name = "transport_callback_base",
    headers = [
        "TransportCallbackBase.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        "//folly:portability",
        "//folly/coro:baton",
        "//folly/coro:task",
        "//folly/io/async:async_transport",
        "//folly/io/async/ssl:ssl_errors",
    ],
)

fb_dirsync_cpp_library(
    name = "transport_callbacks",
    headers = [
        "TransportCallbacks.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        ":transport_callback_base",
        "//folly:network_address",
        "//folly:range",
        "//folly/coro:task",
        "//folly/io:iobuf",
        "//folly/io/async:async_socket",
        "//folly/io/async:async_socket_exception",
    ],
)

fb_dirsync_cpp_library(
    name = "socket",
    srcs = [
        "ServerSocket.cpp",
        "Transport.cpp",
    ],
    headers = [
        "ServerSocket.h",
        "Transport.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
    deps = [
        ":transport_callbacks",
        "//folly:portability",
        "//folly/coro:baton",
    ],
    exported_deps = [
        "//folly:exception_wrapper",
        "//folly:expected",
        "//folly:network_address",
        "//folly:range",
        "//folly/coro:task",
        "//folly/io:iobuf",
        "//folly/io/async:async_socket",
        "//folly/io/async:async_socket_exception",
        "//folly/io/async:server_socket",
    ],
)
